﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Dropthings.Widget.Widgets.ComWeather
{
	/// <summary>指数类</summary>
	public class Exponential
	{
		/// <summary>简写</summary>
		public string Shortening { get; set; }
		/// <summary>内容</summary>
		public string Content { get; set; }
		
		public override string ToString()
		{
			return string.Format("({0})。{1}",this.Shortening,this.Content);
		}
		/// <summary>创建指数类</summary>
		/// <param name="rootNode">指数类的跟节点</param>
		public static Exponential Get(XmlNode rootNode)
		{
            var nodeShortening = rootNode.SelectSingleNode("dd/strong/a/i");
            var nodeContent = rootNode.SelectSingleNode("dd/text()");
            var shortening = string.Empty;
            var content = string.Empty;
            if (nodeShortening != null)
            {
                shortening = nodeShortening.InnerText;
            }
            if (nodeContent != null)
            {
                content = nodeContent.Value;
            }
			return new Exponential()
			{
                Shortening = shortening,
                Content = content
			};
		}
	}
}
